%token ID
%token '<', '>', '>>'

%lexprec ID <~ 'int'

%define pg.lr.type PSLR

%%

lower  = ['a'-'z']
upper  = ['A'-'Z']
digit  = ['0'-'9']
letter = lower | upper | '_'
name   = letter (letter | digit)*

name => ID

%%

S:
    decl ';'
    expr ';'

decl:
    type id

type:
    id '<' type '>'
    ID

expr:
    id '>>' id

id:
    ID
